package com.irdstudio.apicenter.console.service.appframe;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppFrameModule;
import com.irdstudio.apicenter.console.dm.AppFrameModuleDao;
import com.irdstudio.apicenter.console.dm.module.ModuleEntity;

@Service(value = "appFrameModuleService")
public class AppFrameModuleService {
	@Autowired
	private AppFrameModuleDao appFrameModuleDao;

	/**
	 * 获取模块信息
	 * 
	 * @param id
	 * @param name
	 * @param pageNowe
	 * @param pageSiz
	 * @return
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 */
	public List<AppFrameModule> queryAppFrameModuleList(String szCondition,
			String szOrderBy, String conditionSql) throws SQLException,
			ClassNotFoundException {

		return appFrameModuleDao.queryWithCond(szCondition, szOrderBy,
				conditionSql);

	}

	public int deleteAppFrameModule(String appid, String moduleid)
			throws ClassNotFoundException, SQLException {
		return appFrameModuleDao.delete(appid, moduleid);
	}

	public int insertAppFrameModule(AppFrameModule appFrameModule)
			throws ClassNotFoundException, SQLException {
		return appFrameModuleDao.insert(appFrameModule);
	}

	public String[] queryModuleDetail(String moduleid)
			throws ClassNotFoundException, SQLException {
		return appFrameModuleDao.queryModuleDetail(moduleid);
	}

	public List<HashMap<String, String>> queryByAppid(String appId)
			throws SQLException {
		return appFrameModuleDao.queryByAppid(appId);
	}

	public List<HashMap<String, String>> queryByAppid1(String appId)
			throws SQLException {
		return appFrameModuleDao.queryByAppid1(appId);
	}

	public List<ModuleEntity> queryModuleList(String conditionSql)
			throws SQLException, ClassNotFoundException {
		return appFrameModuleDao.queryModule(conditionSql);
	}
	
	public List<AppFrameModule> queryAllByAppId(String appId)
			throws SQLException {
		return appFrameModuleDao.queryAllByAppId(appId);
	}
	
	public List<AppFrameModule> queryAppFrameModuleByParentId(String appId, String parentModuleId) throws SQLException{
		return appFrameModuleDao.queryAppFrameModuleByParentId(appId, parentModuleId);
	}
	
	public int insertFrameModule(AppFrameModule appFrameModule) throws SQLException{
		return appFrameModuleDao.insertFrameModule(appFrameModule);
	}

}
